package com.peng.mybatis.builder.xml;

import com.peng.mybatis.builder.BaseBuilder;
import com.peng.mybatis.mapping.SqlCommandType;
import com.peng.mybatis.session.Configuration;
import org.dom4j.Element;

public class XmlStatementBuilder extends BaseBuilder {

    private String currentNamespace;

    private Element element;

    protected XmlStatementBuilder(Configuration configuration, Element element, String currentNamespace) {
        super(configuration);
        this.element = element;
        this.currentNamespace = currentNamespace;
    }

    //解析语句(select|insert|update|delete)
    /*
        <select
              id="selectPerson"
              parameterType="int"
              parameterMap="deprecated"
              resultType="hashmap"
              resultMap="personResultMap"
              flushCache="false"
              useCache="true"
              timeout="10000"
              fetchSize="256"
              statementType="PREPARED"
              resultSetType="FORWARD_ONLY">
              SELECT * FROM PERSON WHERE ID = #{id}
        </select>
    */
    public void parseStatementNode() {
        String id = element.attributeValue("id");
        Class<?> paramType = resolveAlias(element.attributeValue("parameterType"));
        Class<?> resultType = resolveAlias(element.attributeValue("resultType"));
        SqlCommandType sqlCommandType = SqlCommandType.valueOf(element.getName().toUpperCase());

    }

}
